
:: ST-LINK_CLI.exe -rOB

@REM mode con cols=80 lines=50
@REM :: 设置烧录器路径
set PATH=D:\Program Files\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility


ST-LINK_CLI.exe -List

@REM :: SN后应填写特定于ST-Link的序列码. 但若ST-Link为国产芯片则无法识别序列码

:: 清空读写保护
:: @ST-LINK_CLI.exe -c SN=E1007200D0D2139393740544 SWD UR -OB RDP=0 IWDG_SW=1 nRST_STOP=1 nRST_STDBY=1 Data0=0xFF Data1=0xFF WRP=0xFFFFFFFF

:: 擦除前64页flash
@ST-LINK_CLI.exe -c SN=E1007200D0D2139393740544 SWD UR LPM -SE 0 63
:: 擦除全部flash
@REM @ST-LINK_CLI.exe -c SN=E1007200D0D2139393740544 SWD UR LPM -ME

:: bin烧录
@ST-LINK_CLI.exe -c SN=E1007200D0D2139393740544 SWD UR LPM -P ./build/mucmas.bin 0X08000000 -V "after_programming" 

:: 复位
@ST-LINK_CLI.exe -c SN=E1007200D0D2139393740544 -Rst
